package com.dropdb.demo.controller.wx;

import com.dropdb.demo.bean.Brand;
import com.dropdb.demo.bean.vo.BaseRespVO;
import com.dropdb.demo.bean.vo.GetBrandListVO;
import com.dropdb.demo.service.WxBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author:cheyanjun
 * @date:2020/07/01 09:48
 */
@RestController
@RequestMapping("wx/brand")
public class WxBrandController {

    @Autowired
    WxBrandService wxBrandService;

    /**
     * 品牌列表
     * @param page
     * @param size
     * @return BrandList
     */
    @GetMapping("list")
    public BaseRespVO getBrandList(Integer page,Integer size){
       GetBrandListVO getBrandListVO= wxBrandService.getBrandList(page,size);
       return BaseRespVO.ok(getBrandListVO);
    }

    /**
     * 品牌详情
     * @param id
     * @return BrandDetail
     */
    @GetMapping("detail")
    public BaseRespVO getBrandDetail(Integer id){
        Brand brand=wxBrandService.getBrandDetail(id);
        Map data = new HashMap();
        data.put("brand",brand);
        return BaseRespVO.ok(data);
    }
}
